<template>
  <div>
    <el-form
      class="form-box-role"
      ref="formDataRef"
      :rules="rules"
      :model="form"
      label-width="120px"
    >
      <el-form-item label="角色名称：" prop="name">
        <el-input v-model="form.name" placeholder="请输入角色名称" />
      </el-form-item>
      <el-form-item label="备注：" prop="memo">
        <el-input
          type="textarea"
          :rows="5"
          placeholder="请输入备注"
          v-model="form.memo"
        >
        </el-input>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      rules: {
        name: [
          { required: true, message: "角色名称不能为空！", trigger: "blur" },
        ],
        memo: [
          { required: true, message: "角色描述不能为空！", trigger: "blur" },
        ],
        enableFlag: [
          { required: true, message: "是否启用不能为空！", trigger: "blur" },
        ],
      },
      options: [
        {
          value: "y",
          label: "开启",
        },
        {
          value: "n",
          label: "关闭",
        },
      ],
      form: {
        name: "",
        memo: "",
        enableFlag: "y",
      },
    };
  },
  methods: {
    reset() {
      this.$refs.formDataRef.resetFields();
    },
    show(obj) {
      this.form = obj;
    },
  },
};
</script>

<style lang="scss" scoped>
.form-box-role {
  .el-select {
    width: 100%;
  }
}
</style>
